﻿@{
    ViewBag.Title = "Index";
    Layout = "~/Views/Shared/_Index.cshtml";
}
<script>
    var keyValue = $.request("keyValue");
    $(function () {
        gridList();
    })
    function gridList() {
        var $gridList = $("#gridList");
        $gridList.dataGrid({
            url: "/SiteManage/Supplier/GetGridJson",
            height: $(window).height() - 136,
            colModel: [
                { label: '供应商id', name: 'id',hidden: true },
                { label: '供应商名称', name: 'name', width: 100, align: 'left' },
                { label: '联系人', name: 'the_contact', width: 100, align: 'left' },
                { label: '联系手机', name: 'phone', width: 100, align: 'left' },
                { label: '联系电话', name: 'mobile', width: 100, align: 'left' },
                { label: '城市', name: 'city_id', width: 100, align: 'left' },
                { label: '公司负责人', name: 'company_owner', width: 100, align: 'left' },
                //{ label: '行业领域', name: 'industry_field', width: 100, align: 'left' },
                //{ label: '服务类型', name: 'service_type', width: 100, align: 'left' },
                //{ label: '公司规模', name: 'company_size', width: 100, align: 'left' },
                //{ label: '业务范围', name: 'business_scope', width: 100, align: 'left' },
                //{ label: '业务性质', name: 'business_nature', width: 100, align: 'left' },
                //{ label: '公司简介', name: 'company_profile', width: 100, align: 'left' },
                { label: '状态', name: 'state', width: 100, align: 'left' },
                { label: '对应客服', name: 'customer_service', width: 100, align: 'left' },
                { label: '对应销售人员', name: 'sales', width: 100, align: 'left' },
                //{ label: '', name: 'aptitude', width: 100, align: 'left' },
                //{ label: '来源', name: 'source', width: 100, align: 'left' },
                { label: '', name: 'F_Id', hidden: true }
            ],
            pager: "#gridPager",
            sortname: 'F_Id desc',
            viewrecords: true,
            ondblClickRow: function (rowid, iRow, iCol, e) {
                submitForm()
            }
        });
        $("#btn_search").click(function () {
            var queryJsonSearch = {
                keyword: $("#txt_keyword").val()
            }
            $gridList.jqGrid('setGridParam', {
                postData: { queryJson: JSON.stringify(queryJsonSearch) },
            }).trigger('reloadGrid');
        });
    }

    function submitForm() {
        var selectRow = $("#gridList").jqGridRowValue();
        var sId = selectRow.F_Id;
        if (sId != "" && sId != undefined) {
            if (keyValue.length > 12)
                keyValue = "iframe" + keyValue;
            var supplier = selectRow.name;
            top.frames[ keyValue].setSupplier_id(String(supplier), String(sId));
            $.modalClose();
        }
        else {
            $.modalAlert("请选择您要的数据！", "warning");
        }
    }
</script>

<div class="topPanel">
    <div class="search">
        <table>
            <tr>
                <td>
                    <div class="input-group">
                        <input id="txt_keyword" type="text" class="form-control" placeholder="请输入要查询关键字" style="width: 200px;">
                        <span class="input-group-btn">
                            <button id="btn_search" type="button" class="btn  btn-primary"><i class="fa fa-search"></i></button>
                        </span>
                    </div>
                </td>
            </tr>
        </table>
    </div>
</div>

<div class="gridPanel">
    <table id="gridList"></table>
    <div id="gridPager"></div>
</div>


